class Person {
    constructor(name,genderCode) {
        this._name = name;
        this._genderCode = genderCode;
    }

    get genderCode(){
        return this._genderCode;
    }

    get name() {
        return this._name;
    }

    get genderCode() {
        return "X";
    }
    // snip
}

class Male extends Person {
    get genderCode() {
        return "M";
    }
}

class Female extends Person {
    get genderCode() {
        return "F";
    }
}
const numberOfMales = people.filter(p => p instanceof Male).length;

/****************************************** */

function createPerson(aRecord) {
    switch (aRecord.genderCode) {
        case "M":
            return new Male(aRecord.name,"M");
        case "F":
            return new Female(aRecord.name,"F");
        default:
            return new Person(aRecord.name,"X");
    }
}

function loadFromInput(data) {
    return data.map(aRecord => createPerson(aRecord))
}

const numberOfMales2 = people.filter(p => p.isMale).length;

function isMale() {
    return "M" === this._genderCode;
}
